<extend name="Public/detail_index"/>
<block name="pageHeader">
    <include file="Public/header.channel" channel="填写信息"/>
</block>
<block name="pageContent">
<style>
    .confirm-ul{width: 100%;
        padding: 1em 0;background-color: #fff;}
    .confirm-ul li{width: 100%;list-style: none;text-align: center;}
    .confirm-ul li p{margin: .5em;font-size: 1.4em;}
    .confirm-ul li input{font-size: 1.4em;vertical-align: middle;width: 90%;height: 2.5em;}
    .confirm-ul li #number{width: 3em;text-align: center;border: 1px solid #eaeaea;}
    .confirm-ul li span{cursor: pointer;font-size: 1.2em;user-select: none;}
    .confirm-ul li .select-msg{text-align: left;display: inline-block;width: 90%;padding: .5em;box-sizing: border-box;border: 1px solid #00A8FF;}
    .confirm-ul .msg-title{font-size: 1.4em;color: #777777;text-align: left;margin:1em 0;padding:.5em 0 .5em 5%;
        background-color: #eae7ef;
    }

    .last-li div{height: 2.5em;line-height: 2.5em;font-size: 0.8em; }
    .confirm-ul h5{margin:1.5em 5%;font-size: 1.2em;}
    b.sign {padding:0 1em;background:url("/Public/Home/images/duihao.png") no-repeat center;background-size: 1em; }
    b.sign-no {padding:0 1em;background:url("/Public/Home/images/tanhao.png") no-repeat center;background-size: 1.1em; }
    #ticket_1,#ticket_2{position: fixed;left: -999em;}

    .footer .detail_ico3{padding:0.9em 0 0.8em;font-size: 1.4em; background:#1296db;color: #fff;}

</style>
<form action="{:U('', I())}" class="pageForm" data-toggle="validate" method="post">
    <!-- 菜单id号 -->
    <ul class="confirm-ul">

        <li>
            <!--<p class="msg-title">数量</p>-->
            <!--<span onclick="cut()">－</span>-->
            <!--<input id="number" readonly type="text" data-rule="required" size="20" name="number" value="1">-->
            <!--<span onclick="add()">＋</span>-->
        </li>
        <!--<h5>填写入场人员</h5>-->
        <li>
            <p class="msg-title">姓名</p>
            <input id="chnName" type="text"  name="title" value=""><b></b>
        </li>
        <li>
            <p class="msg-title">手机</p>
            <input id="chnPhone" type="text" data-rule="required" size="20" name="title" value=""><b></b>
        </li>
        <li>
            <p class="msg-title">票种</p>

            <p><label  class="select-msg">人场券<span style="float: right;">×1</span></label>
                <!--<p><label onclick="addBorder(this)"  class="select-msg">人场券</label>-->
                <!--<input id="ticket_1" type="radio" value="1" name="ticket">-->

            </p>
            <!--<p><label onclick="addBorder(this)" for="ticket_2" class="select-msg">VIP专场票</label><input  id="ticket_2" type="radio" value="2" name="ticket"></p>-->

        </li>
    </ul>
</form>
    <div class="footer">
        <ul style="box-sizing: border-box">
            <li style="box-sizing: border-box;padding: 1em 1em 0.8em;width: 50%;text-align: left;font-size: 1.2em;">
                合计：<span style="color: #ff5500;">¥{$active['price']} </span>

            </li>
            <li style="box-sizing: border-box;border-left: solid 1px #D4D4D4;width: 50%">
                <a class="detail_ico3"   href="javascript:submit();">下一步</a>
            </li>
        </ul>
    </div>
<script>
    var regName=/^([\u4e00-\u9fa5]){2,7}$/;
    var regPhone=/^[1][3,4,5,7,8,9][0-9]{9}$/;

    var number=document.getElementById('number');
    function cut() {
        var val=parseInt(number.value);
        if(val>1){
            number.value=val-1;
        }
        else {
            return false;
        }
    }
    function add() {
        var val=parseInt(number.value);
        number.value=val+1;
    }
    function addBorder(a) {
        var ticket=document.getElementsByClassName('select-msg');
        for(var i=0;i<ticket.length;i++){
            ticket[i].style.border=" none";
        }
        a.style.border=" 1px solid #00A8FF";
    }
    function submit() {
        //var index = parent.layer.getFrameIndex(window.name);
        var pid="{:I('get.id')}";
        var name=$("#chnName").val();
        var phone=$("#chnPhone").val();

        //console.log(regName.test(name)&&regPhone.test(phone));

        if(regName.test(name)&&regPhone.test(phone)){
            var data ={};
            data['pid'] = pid;
            data['name'] = name;
            data['phone'] = phone;
            data['active_price'] = "{$active['price']}";
            data['active_name'] = "{$active['title']}";
            data['active_img'] = "{$active['img']}";
            $.ajax({
                url:"{:U('Order/create_goods_order')}",
                data:data,
                type:'post',
                dataType:'json',
                success:function (data) {
                    window.location.href=data.url;
                    console.log(data.url);
                }
            });
        }else{
            layer.msg('请正确填写信息');
            //return false;
        }

    }
</script>
</block>